<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

<%@taglib uri="http://www.springframework.org/tags" prefix="s"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

<style type="text/css">
span {
	color: red;
}
</style>

<link href="mystyle.css" rel="stylesheet">

</head>




<body>
	<h1>Spring 3 _ Hibernate : CM</h1>
	<hr />
	<table width="100%">
		<tr>
			<td><s:message code="welcome.title"/> : <font color="green">${cuser.name}</font></td>
			<td align="right"><a href="logout.htm">Log out</a></td>
		</tr>
	</table>
	<hr />


	<%
		response. setHeader("Cache-Control", "no-cache"); //HTTP 1.1
		response.setHeader("Pragma", "no-cache"); //HTTP 1.0
		response.setDateHeader("Expires", 0); //prevents caching at the proxy server
	%>




<table width="100%">

<tr>
<td>
<img alt="" src="images/contact.jpg">
</td>
<td>



	<form:form action="addContact.htm" commandName="contact">
	
	
		<table>

			<tr>
				<td>Name:</td>
				<td><form:input path="contName" cssClass="form_field"/> 
				<form:errors
						path="contName" /></td>
			</tr>


			<tr>
				<td>Email:</td>
				<td><form:input path="contEmail" cssClass="form_field" /> <form:errors
						path="contEmail" /></td>
			</tr>


			<tr>
				<td>Mobile:</td>
				<td><form:input path="contMobile" cssClass="form_field"/> <form:errors
						path="contMobile" /></td>
			</tr>



			<tr>
				<td>DOB:</td>
				<td><form:input path="contDOB" cssClass="form_field"/>(MM/dd/yyyy) 
				<form:errors
						path="contDOB" /></td>
			</tr>


			<tr>
				<td>Address:</td>
				<td><form:textarea path="contAddress" rows="5" cols="35"></form:textarea></td>
			</tr>
			

			<tr>
				<td></td>
				<td><input type="submit" value="Add Contact" />
				<td>
			</tr>

		</table>

	</form:form>

</td>
</tr>
</table>

	<br />

	<hr />

	<!-- Show User;s Existing Contacts -->
	<table width="100%">

		<c:forEach var="cont" items="${userConts}">
			<tr>
				<td>${cont.contName}</td>
				<td>${cont.contEmail}</td>
				<td>${cont.contMobile}</td>
				<td>${cont.contDOB}</td>
				<td>${cont.contAddress}</td>
				<td><a href="contEdit.htm?contId=${cont.contSNo}">Edit</a></td>
				<td><a href="contDelete.htm?contId=${cont.contSNo}">Delete</a></td>
			</tr>
			<tr>
				<td colspan="7"><hr /></td>
			</tr>
		</c:forEach>
	</table>

</body>
</html>